/*
 * Copyright (C) 2015 备胎金服
 * 未经授权允许不得进行拷贝和修改
 *   http://www.btjf.com/
 */
package com.zhangman.framework.implementation;

import android.content.Context;
import android.os.Build;
import android.view.View;
import com.zhangman.framework.Input;
import java.util.List;

/**
 * Created by zhangman on 2016/11/1 13:31.
 * Email: zhangman523@126.com
 */
public class AndroidInput implements Input {
  TouchHandler mTouchHandler;

  public AndroidInput(Context context, View view, float scaleX, float scaleY) {
    if (Integer.parseInt(Build.VERSION.SDK) < 5) {
      mTouchHandler = new SingleTouchHandler(view, scaleX, scaleY);
    } else {
      mTouchHandler = new MultiTouchHandler(view, scaleX, scaleY);
    }
  }

  @Override public boolean isTouchDown(int pointer) {
    return mTouchHandler.isTouchDown(pointer);
  }

  @Override public int getTouchX(int pointer) {
    return mTouchHandler.getTouchX(pointer);
  }

  @Override public int getTouchY(int pointer) {
    return mTouchHandler.getTouchY(pointer);
  }

  @Override public List<TouchEvent> getTouchEvents() {
    return mTouchHandler.getTouchEvents();
  }
}
